const express = require("express");
const multer = require("multer");
const path = require("path");

const app = express();
const upload = multer({ dest: "uploads/" }); // 文件将保存到 uploads 目录
console.log(upload);
app.post("/upload", upload.single("avatar"), (req, res) => {
  console.log(req.file); // 上传的文件信息
  res.send("File uploaded successfully");
});
app.get("/", (req, res) => {
  res.send("Hello, Express!");
});

app.listen(3050, () => {
  console.log("Server is running on http://localhost:3050");
});
